<?php
namespace Home\Model;
//物品基础属性
class Base{
    protected $redis;
    protected $user;
    protected $username ;
    protected $city;
    public function __construct($user, $class){
        //数据集
        $this->redis = $user->redis;
        $this->user = $user;
        $this->username = $user->username;
        $this->city = $this->user->city;
        $this->class = $class;
    }
   
    public function hMGet($array){
        return $this->redis->hMGet($this->class, $array);
    }
    public function hMset($array){
        return $this->redis->hMset($this->class, $array);
    }
    public function hGetAll(){
        return $this->redis->hGetAll($this->class);
    }
    public function hGet($field){
        return $this->redis->hGet($this->class, $field);
    }
    public function hSet($field, $value){
        return $this->redis->hSet($this->class, $field, $value);
    }
    public function hIncrBy($field, $amount){
        return $this->redis->hIncrBy($this->class, $field, $amount);
    }
    public function hDel($field){
        return $this->redis->hDel($this->class, $field);
    }
    public function hScan($match){
        return $this->redis->hScan($this->class, '0', $match);
    }
    public function hSetNx($field, $value){
        return $this->redis->hSetNx($this->class, $field, $value);
    }
} 